<?php

// @formatter:off
/**
 * @file Class.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * $Id: Class.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/extensions/DuplicatedImages/Class.php $
 */
define("WC_E_DIMAGES_VERSION", "1.0");
define("WC_E_DIMAGES_ROOTDIR", __DIR__);
define("WC_E_DIMAGES_NAME", basename(WC_E_DIMAGES_ROOTDIR));
define("WC_E_DIMAGES_URI", dirname($_SERVER["SCRIPT_NAME"])."/{$wcPaths["extensions-directory-uri"]}/".WC_E_DIMAGES_NAME);

$extensionBasicInfo = array(
	"name" => "DImages",
	"description" => "Duplicated images management system",
	"author" => "Alejandro Dario Simi",
	"version" => WC_E_DIMAGES_VERSION,
	"url" => array(
		"title" => "wcomix:Extension:DImages",
		"href" => "http://wiki.daemonraco.com/wiki/Wcomix:Extension:DImages"
	)
);

$wcPaths["mvc"]["pools"]["actions"][] = __DIR__;
$wcPaths["mvc"]["pools"]["skins"]["actions"][] = __DIR__;

//$wcSideTools[] = array_merge(array(
//	"action" => "dimages:side"
//	), $extensionBasicInfo);

$auxDIR = substr(__DIR__, strlen($wcROOTDIR));
$wcDatabase["tables"][] = "{$auxDIR}/db/wc_dimages.tab.xml";
$wcDatabase["tables"][] = "{$auxDIR}/db/wc_dimages_dups.tab.xml";
$wcDatabase["indexes"][] = "{$auxDIR}/db/wc_dimages.pk.xml";
$wcDatabase["indexes"][] = "{$auxDIR}/db/wc_dimages_dups.pk.xml";
$wcDatabase["indexes"][] = "{$auxDIR}/db/wc_dimages-dif_distance.idx.xml";
$wcDatabase["indexes"][] = "{$auxDIR}/db/wc_dimages-dif_fingerprint.idx.xml";

$wcCronScripts["CTDImages"] = array_merge($extensionBasicInfo, array(
	"auto" => true,
	"enabled" => true,
	"class" => "DImagesCron"
	));
$wcCronProfiles[$wcCronProfile][] = "CTDImages";
//
// Menu @{
function WC_E_DIMAGES_MenuBuilder($code) {
	if($code == WC_MENU_CODE_MAIN) {
		global $wcGroup;
		global $wcMenuItems;

		$wcMenuItems[WC_MENU_CODE_MAIN]["middle"][] = array(
			"name" => "Duplicated Images",
			"title" => "Duplicated Images",
			"ficon" => WC_E_DIMAGES_URI."/images/dimages-256px.png",
			"url" => "?action=dimages:bydistance&group={$wcGroup->id()}"
		);
	}
}
$wcMenuBuilders[] = "WC_E_DIMAGES_MenuBuilder";
//@}
//
// Loading cron.
// Warning: they only load when it is a shell execution.
// @{
if(defined("__SHELL__")) {
	include WC_E_DIMAGES_ROOTDIR."/includes/DImagesCron.php";
}